package com.chinaisafe.user.entity;

import java.io.Serial;
import com.chinaisafe.user.vo.request.SysDeptDimensionReqVO;
import com.chinaisafe.user.vo.response.SysDeptDimensionRespVO;
import com.chinaisafe.user.dto.SysDeptDimensionDTO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.chinaisafe.base.mybatisplus.entity.BaseEntity;
import java.io.Serializable;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * SysDeptDimension
 * Description：部门维度实体类
 *
 * @author tby
 * @date  2024-07-16 14:28:47
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("sys_dept_dimension")
@Schema(name = "SysDeptDimension", description = "部门维度")
public class SysDeptDimension extends BaseEntity {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "名称")
    @TableField("`name`")
    private String name;

    @Schema(description = "编码")
    @TableField("`code`")
    private String code;

    @Schema(description = "说明")
    @TableField("summary")
    private String summary;

    /**
     * 将请求值对象装换为实体类
     *
     * @param reqVO 请求值对象
     * @return SysDeptDimension
     * @author tby
     * @date 2024-07-16 14:28:47
     */
    public static SysDeptDimension convertFromReqVo(SysDeptDimensionReqVO reqVO) {
        SysDeptDimension entity = new SysDeptDimension();
        entity.setId(reqVO.getId());
        entity.setVersion(reqVO.getVersion());
        // 给实体对应的字段赋值 可根据实际业务删减
        entity.setName(reqVO.getName());
        entity.setCode(reqVO.getCode());
        entity.setSummary(reqVO.getSummary());
        return entity;
    }

    /**
     * 将实体类转换为响应值对象
     *
     * @return SysDeptDimensionRespVO
     * @author tby
     * @date 2024-07-16 14:28:47
     */
    public SysDeptDimensionRespVO convertToRespVO() {
        SysDeptDimensionRespVO respVo = new SysDeptDimensionRespVO();
        respVo.setId(this.getId());
        respVo.setVersion(this.getVersion());
        // 给响应值对象对应的字段赋值 可根据实际业务删减
        respVo.setName(this.getName());
        respVo.setCode(this.getCode());
        respVo.setSummary(this.getSummary());
        return respVo;
    }

    /**
     * 将实体类转换为传输值对象
     *
     * @return SysDeptDimensionDTO
     * @author tby
     * @date 2024-07-16 14:28:47
     */
    public SysDeptDimensionDTO convertToDTO() {
        SysDeptDimensionDTO dto = new SysDeptDimensionDTO();
        dto.setId(this.getId());
        // 给传输值对象对应的字段赋值 可根据实际业务删减
        dto.setName(this.getName());
        dto.setCode(this.getCode());
        dto.setSummary(this.getSummary());
        return dto;
    }
}
